﻿using Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly AIYDBContext db;
        public UserController(AIYDBContext context)
        {
            db = context;
        }

        [HttpGet("/GetAll")]
        public object GetAll()
        {
            return db.user.Where(s => s.Age == 11).Select(a =>new
            {
                a.Gender,
                a.DelTime,
                a.AddTime
            }).ToList();
        }

        [HttpGet]
        public List<EM_user> GetAllbyId()
        {
            return db.user.ToList();
        }
    }
}
